$OpenBSD: patch-native_apache-1_3_mod_jk_c,v 1.2 2014/03/27 10:35:19 dcoppa Exp $
--- native/apache-1.3/mod_jk.c.orig	Sun Dec  8 21:11:13 2013
+++ native/apache-1.3/mod_jk.c	Thu Mar 27 11:22:16 2014
@@ -700,6 +700,7 @@ static int init_ws_service(apache_private_data_t * pri
     const char *route = NULL;
     rule_extension_t *e;
     jk_request_conf_t *rconf;
+    in_port_t remote_port;
 
     /* Copy in function pointers (which are really methods) */
     s->start_response = ws_start_response;
@@ -730,8 +731,13 @@ static int init_ws_service(apache_private_data_t * pri
     }
     else {
         s->remote_addr = r->connection->remote_ip;
-        s->remote_port = ap_psprintf(r->pool, "%d",
-                                     ntohs(r->connection->remote_addr.sin_port));
+        if (r->connection->remote_addr.ss_family == AF_INET)
+            remote_port = ((struct sockaddr_in *)(&r->connection->remote_addr))->sin_port;
+        else if (r->connection->remote_addr.ss_family == AF_INET6)
+            remote_port = ((struct sockaddr_in6 *)(&r->connection->remote_addr))->sin6_port;
+        else
+            remote_port = 0;
+        s->remote_port = ap_psprintf(r->pool, "%d", ntohs(remote_port));
     }
     s->remote_addr = get_env_string(r, s->remote_addr,
                                     conf->remote_addr_indicator, 1);
